﻿using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;

namespace Coldairarrow.Business.AOP
{
    /// <summary>
    /// 工作流删除操作类
    /// </summary>
    public class OverFlowDeleteAttribute : BaseAOPAttribute
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public OverFlowDeleteAttribute()
        {
        }

        /// <summary>
        /// 操作之后执行
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override async Task After(IAOPContext context)
        {
            var op = context.ServiceProvider.GetService<IOperator>();
            var data = context.Arguments[0];
            List<string> Ids = data.ToJson().ToList<string>();
            op.DeleteOverFlowTask(Ids);
            await Task.CompletedTask;
        }
    }
}
